﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EZCRS.HCMS.Entity;
using EZCRS.HCMS.Data;

namespace EZCRS.HCMS.SqlClient
{
    public class sql_hcrs_facility
    {
        #region 分类
        public List<HCRS_Facilityclass> getallfclass()
        {
            return ExecSql.GetTableList<HCRS_Facilityclass>("select * from HCRS_Facilityclass");
        }
        #endregion

        public List<HCRS_Facility> getallfacility(int ltype,string nkey)
        {
            string sqlstr = "select * from HCRS_Facility where languagetype="+ltype.ToString();
            if (nkey != "")
                sqlstr += " and fname like '%"+nkey+"%'";
            sqlstr += " order by fclass";
            return ExecSql.GetTableList<HCRS_Facility>(sqlstr);
        }


        public bool insertorupdate(HCRS_Facility _f)
        {
            return ExecSql.InsertOrUpdateData<HCRS_Facility>(_f);
        }

        public bool delfacility(int id)
        {
            if (ExecSql.SqlExecNoquery("delete from HCRS_Facility where id="+id.ToString()) > 0)
                return true;
            else
                return false;
        }
    }
}
